/**
 *
 * @author Craig Rowe, Richard Garcia, Andrew Blowe, Ryan Huffman
 */
import java.awt.*;  //imports the AWT library
import java.awt.event.*;    //imports the events section of AWT library
class MessageBox extends Dialog implements ActionListener //sets up the message boxes which display the error messages
{
    Button ok;  //creates an object of the button type

    MessageBox(Frame f, String title, boolean mode, String message) //sets up the message box frame
    {
        super(f, title, mode);  //call to super class
        Panel centerPanel = new Panel();    //sets up the pane
        Label label = new Label(message);   //adds a label to display the error
        centerPanel.add(label); //adds the label to the pane
        add(centerPanel, "Center"); //centers the text
        Panel southPanel = new Panel(); //sets up the southern part of the pane for ok button
        ok = new Button ("OK"); //creates an OK button
        ok.addActionListener(this);  //adds action listener
        southPanel.add(ok); //adds the ok button to the southern section of pane
        add(southPanel, "South"); //adds this pane to the whole message box frame
        pack(); //packs all of the components together

        addWindowListener (new WindowAdapter() //adds a listener so it will close when the ok is clicked
        {
            public void windowClosing (WindowEvent windowEvent) 
            {
                System.exit(0);
            }
        });
    }


    public void actionPerformed(ActionEvent actionEvent) //action event for closing
    {
        dispose(); //ends the message box process
    }
}

